//
//  NetWorkState.m
//  16UILessonGetRequest
//
//  Created by lanou on 16/1/14.
//  Copyright (c) 2016年 HHUI. All rights reserved.
//

#import "NetWorkState.h"
#import "Reachability.h"
@implementation NetWorkState
+ (NetWorkState *)shareInstance
{
    static NetWorkState *net = nil;
    if (net == nil) {
        net = [[NetWorkState alloc]init];
    }
    return net;
}

- (BOOL)reachability
{
    Reachability *r = [Reachability reachabilityWithHostName:@"www.baidu.com"];
    
    switch ([r currentReachabilityStatus]) {
        case NotReachable:
            NSLog(@"没有网络");
            return NO;
            break;
         case ReachableViaWWAN:
            NSLog(@"移动网络");
            return YES;
            
         case ReachableViaWiFi:
            NSLog(@"wifi网络");
            return YES;
            
        default:
            break;
    }
}
@end
